package com.hyx.spring.bean;

import javax.annotation.PostConstruct;

/**
 * @Author hyx
 * @Description 测试Java中的@PostConstruct注解和@PreDestroy注解
 * @Date 2024/3/10 21:27
 * @Version 1.0
 */
public class Cat {

    public Cat(){
        System.out.println("执行了CAT类中无参数的构造方法");
    }

    public void init(){
        System.out.println("执行了cat类中的init初始化方法");
    }

    @PostConstruct
    public void postConstruct(){
        System.out.println("执行了CAT类的postConstruct方法");
    }

    public void preDestroy(){
        System.out.println("执行了CAT类的preDestroy方法");
    }

    public void destroy(){
        System.out.println("执行了CAT类的destroy方法");
    }
}
